<template>
	<view>
		<view class="search">
			<u--input v-model="query.searchValue" placeholder="请输入关键字" :clearable="true" prefixIcon="search"
				prefixIconStyle="font-size: 22px;color: #909399" @clear="getList()">
				<template slot="suffix">
					<view class="search_btn" @click="getList()"> 搜索</view>
				</template></u--input>
		</view>
		<view class="tabs">
			<u-tabs :scrollable="false" :list="list1" @click="click" lineWidth="30" lineColor="#3c9cff" :activeStyle="{
            color: '#303133',
            fontWeight: 'bold',
            transform: 'scale(1.05)'
        }" :inactiveStyle="{
            color: '#606266',
            transform: 'scale(1)'
        }" itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"></u-tabs>
		</view>
		<view class="box "   v-for="(v,i) in datas" :key="i" @click="jumpTo('/pages/rulesAndRegulations/detatl',{
			id:v.id,
			name:v.name,
			category :v.category 
		})">
			<view class="box_name">{{v.name}}</view>
			<div class="box_botton flex">
				<view class="box_left">{{Txt.get(  v.category - 0) }}</view>
				<view class="box_right">{{v.createDate}}</view>
			</div>
		</view>
	</view>
</template>

<script>
	import {
		systemDetails,
		systemList
	} from '@/api/rulesAndRegulations.js'
	const Txt  = new Map([
		[1,"法律法规"],
		[2,"规章制度"],
		[3,"操作规程"]
	])
	export default {
		data() {
			return {
				Txt,
				query: {
					searchValue: '',
					category: '',
					PAGE_NO: 1,
					PAGE_SIZE: 10000
				},
				list1: [{
					name: '全部',
					value: ''
				}, {
					name: '法律法规',
					value: '1'
				}, {
					name: '规章制度',
					value: '2',

				}, {
					name: '操作规程',
					value: '3',
				}],
				datas: []
			};
		},
		onLoad() {
			this.getList()
		},
		methods: {
			async getList() {
				const res = await systemList(this.query)
				console.log(res, "res");
				this.datas = res.rows
			},
			click(e) {
				console.log(e, "e");
				this.query.category = e.value
				this.getList()
			}
		}
	}
</script>
<style>
	page {
		background-color: #F6F6F6;
	}
</style>
<style lang="scss" scoped>
	.search {
		/deep/.u-input {
			width: 688rpx;
			height: 65rpx;
			background: #FFFFFF;
			border: 1rpx solid #CCCCCC;
			margin: 0 auto;
			margin-top: 15rpx;
			border-radius: 32rpx;
		}

		&_btn {
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 29rpx;
			color: #666666;
			padding-left: 10rpx;
			border-left: 1rpx solid #E0E0E0;
		}
	}

	.tabs {
		padding: 10rpx 0;
		background-color: #FFF;
		margin-top: 30rpx;
	}
	.box{
		margin-top: 20rpx;
		background-color: #FFF;
		padding: 30rpx;
		&_name{
			font-size: 36rpx;
			font-weight: 600;
			 display: -webkit-box;
			    -webkit-box-orient: vertical;
			    overflow: hidden;
			    text-overflow: ellipsis;
			    /* 显示两行文字 */
			    -webkit-line-clamp: 2;
			    /* 指定行高，根据需要调整 */
			    line-height: 1.5; /* 假设每行高度为 1.5 倍字体大小 */
		}
		&_botton{
			margin-top: 20rpx;
			justify-content: space-between;
			align-items: center;
		}
		&_left{
			padding: 10rpx 20rpx;
			color: #3c9cff;
			background-color: #ecefff;
			border-radius: 5rpx;
		}
	}
</style>